package cn.tedu.rtc.sdk.websocket;

import com.fasterxml.jackson.annotation.JsonProperty;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * WebSocket通用响应格式
 * The format of WebSocket messages that the pilot can receive.
 */
public class WebSocketMessageResponse<T> {

    /**
     * @see BizCodeEnum
     * specific value
     */
    @JsonProperty("biz_code")
    @NotNull
    private String bizCode;

    private String version = "1.0";

    @NotNull
    @Min(123456789012L)
    private Long timestamp;

    @NotNull
    private T data;

    public WebSocketMessageResponse() {
    }

    @Override
    public String toString() {
        return "WebSocketMessageResponse{" +
                "bizCode=" + bizCode +
                ", version='" + version + '\'' +
                ", timestamp=" + timestamp +
                ", data=" + data +
                '}';
    }

    public String getBizCode() {
        return bizCode;
    }

    public WebSocketMessageResponse<T> setBizCode(String bizCode) {
        this.bizCode = bizCode;
        return this;
    }

    public String getVersion() {
        return version;
    }

    public WebSocketMessageResponse<T> setVersion(String version) {
        this.version = version;
        return this;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public WebSocketMessageResponse<T> setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
        return this;
    }

    public T getData() {
        return data;
    }

    public WebSocketMessageResponse<T> setData(T data) {
        this.data = data;
        return this;
    }
}